-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to Groovy 4.0 #8010
Update to Groovy 4.0 #8010
Conversation
I think one of the bugs I had to workaround is https://issues.apache.org/jira/browse/GROOVY-10060 |
@@ -111,6 +116,11 @@ import jakarta.inject.Singleton | |||
class Config | |||
{ | |||
Boolean boolProperty | |||
|
|||
// TODO: Why do we need this? Groovy bug? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raised https://issues.apache.org/jira/browse/GROOVY-10762 to see if it's a bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's expected and not a bug, fixed in fd8d885
Still not sure why they are required
@@ -46,6 +46,15 @@ tasks.withType(Jar).configureEach { | |||
preserveFileTimestamps = false | |||
} | |||
|
|||
configurations.all { | |||
resolutionStrategy.eachDependency { DependencyResolveDetails details -> | |||
if (details.requested.group == 'org.codehaus.groovy') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So while this will work to build and execute this module, this won't be propagated to consumers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's ok... It's only stopping the micronaut-build internal plugin pulling in the codehaus dependency here
Once micronaut-build is updated, I believe we can get rid of this
tasks.named("test", Test) { | ||
if(JavaVersion.current().majorVersion.toInteger() >= 17) { | ||
jvmArgs( | ||
'--add-opens', 'jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole block is a bit scary!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but without it we get
java.lang.IllegalAccessError: class org.jetbrains.kotlin.kapt3.base.KaptContext (in unnamed module @0x7a4f0f29) cannot access class com.sun.tools.javac.util.Context (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0x7a4f0f29
All the way down until you end up with the above list. I think it's because we're effectively hand-cranking Kapt from Groovy, but I have no proof...
test-suite-geb/build.gradle
Outdated
|
||
testImplementation libs.geb.spock | ||
testImplementation libs.spock.for.geb | ||
testImplementation "org.codehaus.groovy:groovy-test:3.0.12" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional that it uses an old version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, test-suite-geb
runs Geb on Groovy 3 (as there's no Geb that works with Groovy 4 -- yet)
@@ -15,7 +15,9 @@ dependencies { | |||
api project(":core-reactive") | |||
api libs.managed.validation | |||
|
|||
compileOnly libs.managed.gorm | |||
compileOnly(libs.managed.gorm) { | |||
exclude(module: 'groovy') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm, we should figure out why an exclude is needed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libs.managed.gorm
is org.grails:grails-datastore-core:7.3.2
at time of writing which has a compile dependency on Groovy 3
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<version>3.0.11</version>
<scope>compile</scope>
</dependency>
This is just a compile only dependency, but we may be breaking gorm integration until grals release a Groovy 4 version of their libraries that we consume
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove GORM information from the documentation?
Maybe add it later once there is a version of GORM compatible with Groovy 4.
Or add an Asciidoc callout?
...-server-netty/src/test/groovy/io/micronaut/http/server/netty/binding/HttpResponseSpec.groovy
Outdated
Show resolved
Hide resolved
inject-groovy/src/main/groovy/io/micronaut/ast/groovy/visitor/GroovyClassElement.java
Show resolved
Hide resolved
Kudos, SonarCloud Quality Gate passed! |
This PR switches the Groovy version in core to 4.0.5
test-groovy-geb
which runs with Groovy 3 on the classpathisXXX
getters forBoolean
fields (it does forboolean
) -- this is discussed over here on the Groovy Jira, and a fix has been added to only checkisXXX
for primitive booleansstatic void foo()
, andConcrete implements Interface
then Groovy must callInterface.foo()
, notConcrete.foo()
. This is an expected change -- I asked in the Groovy JIRAinject-kotlin-test/.../KotlinCompilerTest
fails with Groovy 4 as theNote
for beans being created are picked up as a catastrophic failure by the test harness. I added a check to ignore Notes, as this is only under test when Groovy is creating a kotlin build with Kapt processing